package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author 东哥
 * @since 2024-08-25
 */
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
@Api(tags = "互动问答-用户端-回答的相关接口 ")
public class InteractionReplyController {
    private final IInteractionReplyService replyService;

    /**
     * 分页查询回答或评论列表  实战 3
     *
     * @param replyPageQuery
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("分页查询回答或评论列表")
    public PageDTO<ReplyVO> queryReply(ReplyPageQuery replyPageQuery) {
        return replyService.queryReply(replyPageQuery, true);
    }
    private final IInteractionReplyService interactionReplyService;
    /**
     * day7，新增回答或评论接口，实战4
     * @param replyDTO
     */
    @PostMapping
    @ApiOperation("新增回答或评论接口")
    public void addReply(@RequestBody ReplyDTO replyDTO){
        interactionReplyService.addReply(replyDTO);
    }
}

